package fileIO;

import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

public class WriteTxTFile {
	
	
	public void writeFile(String text, String path){
		String charsetName = "UTF-8";
		BufferedWriter bw = null;
		try {
			bw = new BufferedWriter(new OutputStreamWriter(new BufferedOutputStream
					(new FileOutputStream(new File(path)) ), charsetName));
			bw.write(text);
		} catch (IOException e) {
			e.printStackTrace();
		}
		finally {
			if(bw != null){
				try {
					bw.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		
	}

}
